// 计牌类
class ScorePanel{
    // 分数
    score = 0;
    // 等级
    level = 1;

    scoreElement : HTMLElement;
    levelElement : HTMLElement;

    // 等级最大数
    maxLevel: number;
    // 提升一等级倍数
    levelMultiple:number;
    constructor(maxLevel:number = 10,levelMultiple:number = 5){
        this.scoreElement = document.getElementById('score')!;
        this.levelElement = document.getElementById('level')!;
        this.maxLevel = maxLevel
        this.levelMultiple = levelMultiple
    }
    // 累加分数
    public addScore(){
        if ( this.score!= 0 && this.score % this.levelMultiple == 0){
            this.updateLevel()
        }
        this.score++;
        this.scoreElement.innerHTML = this.score.toString();
    }
    // 增加等级
    public updateLevel(){
        console.log(this.score,'最小了')
        if(this.level < this.maxLevel){
            this.level++;
            this.levelElement.innerHTML = this.level.toString()
        }

    }
}

export default ScorePanel